<?php
error_reporting(E_ALL);

include_once 'layout.php';
include_once 'step_4.php';

openHeader();
closeHeader();
openBody(4);

// filter the top X percentage:
$percentage = 5;
?>
<h1>Recommendations</h1>
This list contains the candidates who scored within <?php echo $percentage;?>% of your highest match. To view the results of all candidates, <a href="step_3_view.php">click here</a>.<br /><br />
We recommend that you take a detailed look at these candidates, who they are and what they stand for, to decide who gets your vote! Click <a href="http://www.eveonline.com/council/voting/">here</a> to vote.<br /><br />
<?php
echo '<table border="1">';
$rankings = getWithinPercent($percentage);
$count = count($rankings);

for($i = 0; $i < 4; $i++) {
	echo '<tr>';
	for($k = 0; $k < $count; $k++) {
		switch($i) {
			case 0:
				echo '<td class="c_namelink"><a href="https://gate.eveonline.com/Profile/' . $rankings[$k][0] . '">' . $rankings[$k][0] . ' (' . $rankings[$k][3] . '%)</a></td>';
				break;
			case 1:
				echo '<td class="c_portrait"><center><img src="https://image.eveonline.com/Character/' . $rankings[$k][5] . '_256.jpg" /></center></td>';
				break;
			case 2:
				echo '<td class="c_realname"><b>' . $rankings[$k][4] . '</b><br /><i>'  . $rankings[$k][6] . '</i><br />'  . $rankings[$k][7];
				echo '<br /><a href="' . $rankings[$k][2] . '">' . $rankings[$k][2] . '</a>';
				echo '</td>';
				break;	
			case 3:
				echo '<td class="c_description">' . nl2br($rankings[$k][1]) . '</td>';
				break;
		}	
	}
	echo '</tr>';
}
echo '</table>';
closeHolder();
closeBody(); 
?>